﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gui.Service
{
    class Api
    {
        private static string token;
        public static async Task Login(string code) 
        {
            var result = await ApiClient.Instance().Get<LoginResult>("/login?code=" + code);
            if (result.errMsg != null)
            {
                throw new Exception(result.errMsg);
            }
            token = result.token;
        }

        public static async Task<PersonInfoResult> GetPersonInfo()
        {
            return await ApiClient.Instance().Get<PersonInfoResult>("/personinfo?token=" + token);
        }

        
    }
}
